<template>
  <div id="app" class="app-container">
    <mt-header title="vue项目">
		<mt-button icon="back" slot="left" @click="back" v-show="isShow"></mt-button>
		</mt-header>
		<transition ><router-view /></transition>
	<nav class="mui-bar mui-bar-tab">
			<router-link class="mui-tab-item-xw" to="/home">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</router-link>
			<router-link class="mui-tab-item-xw" to="/weather">
				<span class="mui-icon mui-icon-extra mui-icon-extra-holiday"></span>
				<span class="mui-tab-label">天气</span>
			</router-link>
			<router-link class="mui-tab-item-xw" to="/car">
				<span class="mui-icon mui-icon-extra mui-icon-extra-cart"><span class="mui-badge">9</span></span>
				<span class="mui-tab-label">购物车</span>
			</router-link>
			<router-link class="mui-tab-item-xw" to="/search">
				<span class="mui-icon mui-icon-search"></span>
				<span class="mui-tab-label">搜索</span>
			</router-link>
		</nav>
  </div>
</template>

<script>
export default {
  name: 'App',
  data (){
	  return {
		  isShow:false
	  }
  },
  methods:{
	  back() {
		  this.$router.go(-1);
	  }
  },
  watch:{
	  $route(now,old){
		  if(now.path=="/home"){
			  this.isShow=false;
		  } else {
			  this.isShow=true;
		  }
	  }
  }
}
</script>

<style>
.app-container{
	padding-bottom: 58px;
}
.v-enter,
.v-leave-to{
	opacity: 0;
	transform: translateX(100%);
}

.v-enter-active,
.v-leave-active {
	transform: all 0.5s ease;
}
.mui-bar-tab .mui-tab-item-xw.mui-active{
	color: #007AFF;
}
.mui-bar-tab .mui-tab-item-xw {
    display: table-cell;
    overflow: hidden;
    width: 1%;
    height: 50px;
    text-align: center;
    vertical-align: middle;
    white-space: nowrap;
    text-overflow: ellipsis;
    color: #929292;
}
.mui-bar-tab .mui-tab-item-xw .mui-icon {
    top: 3px;
    width: 24px;
    height: 24px;
    padding-top: 0;
    padding-bottom: 0;
}
.mui-bar-tab .mui-tab-item-xw .mui-icon~.mui-tab-label {
    font-size: 11px;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}
</style>
